\(\int \cos (c+d x) (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [41]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 16 \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=B x+\frac {C \text {arctanh}(\sin (c+d x))}{d} \]

[Out]

B*x+C*arctanh(sin(d*x+c))/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {4132, 8, 12, 3855} \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {C \text {arctanh}(\sin (c+d x))}{d}+B x \]

[In]

Int[Cos[c + d*x]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

B*x + (C*ArcTanh[Sin[c + d*x]])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4132

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rubi steps \begin{align*} \text {integral}& = B \int 1 \, dx+\int C \sec (c+d x) \, dx \\ & = B x+C \int \sec (c+d x) \, dx \\ & = B x+\frac {C \text {arctanh}(\sin (c+d x))}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00 \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=B x+\frac {C \text {arctanh}(\sin (c+d x))}{d} \]

[In]

Integrate[Cos[c + d*x]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

B*x + (C*ArcTanh[Sin[c + d*x]])/d

Maple [A] (verified)

Time = 0.12 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.81

method result size
derivativedivides \(\frac {C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B \left (d x +c \right )}{d}\) \(29\)
default \(\frac {C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B \left (d x +c \right )}{d}\) \(29\)
parallelrisch \(\frac {B x d -C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) \(39\)
risch \(B x +\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}\) \(42\)
norman \(\frac {B x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}-B x}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}+\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(87\)

[In]

int(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(C*ln(sec(d*x+c)+tan(d*x+c))+B*(d*x+c))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 36 vs. \(2 (16) = 32\).

Time = 0.26 (sec) , antiderivative size = 36, normalized size of antiderivative = 2.25 \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, B d x + C \log \left (\sin \left (d x + c\right ) + 1\right ) - C \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(2*B*d*x + C*log(sin(d*x + c) + 1) - C*log(-sin(d*x + c) + 1))/d

Sympy [F]

\[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \left (B + C \sec {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

Integral((B + C*sec(c + d*x))*cos(c + d*x)*sec(c + d*x), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 37 vs. \(2 (16) = 32\).

Time = 0.20 (sec) , antiderivative size = 37, normalized size of antiderivative = 2.31 \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, {\left (d x + c\right )} B + C {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )}}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(2*(d*x + c)*B + C*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 43 vs. \(2 (16) = 32\).

Time = 0.28 (sec) , antiderivative size = 43, normalized size of antiderivative = 2.69 \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {{\left (d x + c\right )} B + C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - C \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{d} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

((d*x + c)*B + C*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - C*log(abs(tan(1/2*d*x + 1/2*c) - 1)))/d

Mupad [B] (verification not implemented)

Time = 15.21 (sec) , antiderivative size = 57, normalized size of antiderivative = 3.56 \[ \int \cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2\,B\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \]

[In]

int(cos(c + d*x)*(B/cos(c + d*x) + C/cos(c + d*x)^2),x)

[Out]

(2*B*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*C*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d